package com.qingae.util.notice;

import java.io.IOException;

import javax.media.CannotRealizeException;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.media.Time;

import com.qingae.earn.constants.EarnCommonConstants;

public class MediaPlayerUtil {
	private static final MediaLocator MEDIALOC = new MediaLocator("file:" + ClassLoader.getSystemResource(EarnCommonConstants.FILE_PATH).getPath());
	private static final double SECONDS = EarnCommonConstants.SECONDS;
	
	public static void playMusic() throws NoPlayerException, CannotRealizeException, IOException {
		Player play = Manager.createRealizedPlayer(MEDIALOC);
		play.setStopTime(new Time(SECONDS));
		play.start();
		play = null;
	}
	
	public static void main(String[] args) {
		try {
			playMusic();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
